<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>.
    <style>
        * {
            margin: 0 auto;

        }

        #mask {
            width: 3000px;
            height: 3000px;
            background-color: grey;
            position: absolute;
        }

        #box {
            width: 1024px;
            height: 800px;
            position: absolute;
            top: 50px;
            left: 100px;
            background-color: white;
            border: 2px dashed white;
        }

        a img {
            width: 30px;
            height: 60px;
        }

        .left {
            width: 30px;
            height: 60px;
            position: absolute;
            left: 0px;
            top: 45%;
        }

        .right {
            width: 30px;
            height: 60px;
            position: absolute;
            right: 0px;
            top: 45%;
        }

        .pc {
            width: 700px;
            height: 468px;
        }
    </style>
</head>

<body>

    <div id="mask">
        <div id="box">
            <h3>这是一个example</h3>
            <img class="pc" :src="imgArr[index]" alt="">
            <a href="javascript:void(0)" @click="prev" class="left" v-show="index!=0">
                <img src="../pic/prev.jpg" alt="">
            </a>
            <a href="javascript:void(0)" @click="next" class="right" v-show="index!=5">
                <img src="../pic/next.jpg" alt="">
            </a>


        </div>

    </div>
</body>
<script src="../vue.js"></script>
<script>
    var i = this.index;
    var mask = new Vue({

        el: "#mask",
        data: {
            imgArr: [
                "../pic/01.jpg",
                "../pic/02.jpg",
                "../pic/03.jpg",
                "../pic/04.jpg",
                "../pic/05.jpg",
                "../pic/06.jpg"

            ],

            index: 0
        },

        methods: {

            prev: function () {
                if (this.index >= 0) {
                    this.index--;
                } else {
                    alert("没照片了");
                }

            },

            next: function () {
                if (this.index < 6) {
                    this.index++;
                } else {
                    alert("没照片了")
                }


            }

        }


    })
</script>

</html>